package com.example.activitytest

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import kotlinx.android.synthetic.main.answer_layout.*
import kotlinx.android.synthetic.main.first_layout.*

class AnswerActivity() : AppCompatActivity() {
    var repage:String=""
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.answer_layout)
        var bundle=this.intent.extras
        var answer=(bundle?.get("answer")).toString()
        var page=(bundle?.get("page")).toString()
        repage=page
        when(answer){
            "0"->{
                textView.setText("正确答案\n     A")
            }
            "1"->{
                textView.setText("正确答案\n     B")
            }
            "2"->{
                textView.setText("正确答案\n     C")
            }
            "3"->{
                textView.setText("正确答案\n     D")
            }
        }
    }

    override fun onBackPressed() {
        val intent =Intent()
        intent.putExtra("repage",repage)
        setResult(RESULT_OK,intent)
        finish()
    }
}